Earth_Radius=6372795;
// широта (latitude) - a 
// долгота (longitude) - y

function [ang,r]=distance1(a0,y0,a1,y1)
    
endfunction


function [r]=distance2 (a1,y1,a2,y2)    
t1 = (cosd(a2)*sind(y2-y1))^2;
t2 = (cosd(a1)*sind(a2)-sind(a1)*cosd(a2)*cosd(y2-y1))^2;
t3 = sind(a1)*sind(a2)+cosd(a1)*cosd(a2)*cosd(y2-y1);
delta_ang = atand(sqrt(t1+t2)/t3);
disp(delta_ang);
r = Earth_Radius*delta_ang*%pi/180;
disp(r);
endfunction

a0 = 77.1539
y0 = -120.398
a1 = 77.1804
y1 = 129.55

distance2(a0,y0,a1,y1);